#define  _CRT_SECURE_NO_WARNINGS 1

#include "BinaryTree.h"

void TestBinaryTree()
{
	const BTDataType* str = "ABDG###EH###C#F##";

	pBTNode root = CreateTree(str);
	PrevOrder(root);
	printf("\n");

	InOrder(root);
	printf("\n");

	PostOrder(root);
	printf("\n");

	LevelOrder(root);
	printf("\n");

	printf("0: %d\n", TreeKLevelNodeSize(root, 0));
	printf("1: %d\n", TreeKLevelNodeSize(root, 1));
	printf("2: %d\n", TreeKLevelNodeSize(root, 2));
	printf("3: %d\n", TreeKLevelNodeSize(root, 3));
	printf("4: %d\n", TreeKLevelNodeSize(root, 4));
	printf("5: %d\n", TreeKLevelNodeSize(root, 5));

	printf("TreeNodeSize: %d\n", TreeNodeSize(root));
	printf("TreeLeafNodeSize: %d\n", TreeLeafNodeSize(root));
	printf("MaxDepth: %d\n", MaxDepth(root));
	printf("MinDepth: %d\n", MinDepth(root));

	/*root = ReverseTree(root);
	PrevOrder(root);
	printf("\n");*/

	bool ret = IsBalancedTree(root);

	if (ret)
	{
		printf("true\n");
	}
	else
	{
		printf("false\n");
	}

	pBTNode root1 = CreateTree(str);
	ret = IsSame(root, root1);
	if (ret)
	{
		printf("true\n");
	}
	else
	{
		printf("false\n");
	}

	const BTDataType* str1 = "AAA2###AA###A#A##";
	pBTNode root2 = CreateTree(str1);
	ret = IsSingle(root2);
	if (ret)
	{
		printf("true\n");
	}
	else
	{
		printf("false\n");
	}
}

int main()
{
	TestBinaryTree();

	return 0;
}